#ifndef SECRETKEYACTIVATIONWIDGET_H
#define SECRETKEYACTIVATIONWIDGET_H

#include <QWidget>
#include <QTimer>
#include <QMessageBox>
#include <QKeyEvent>
#include "receive_dbus.h"
#include "interface.h"
extern "C" {
#include <kylin-activation.h>
}

namespace Ui {
class SecretKeyActivationWidget;
}

class SecretKeyActivationWidget : public QWidget
{
    Q_OBJECT

public:
    explicit SecretKeyActivationWidget(QWidget *parent = nullptr);
    ~SecretKeyActivationWidget();

    void clearData();
    QTimer *m_timer=nullptr;
    void resetControlsState(int type);

private:
    Ui::SecretKeyActivationWidget *ui;

    QString errorText;
    gint canset_serial_flag = 0;

signals:
    void returnSignal();
    void sendOfflineSignal();
    void activateSucceed();
    void activationMessageSignal(int activation);//激活信息发送信号

private slots:
    void on_returnbtn_clicked();
    void on_activebtn_clicked();

protected:
    void activeSys(QString serial, QString code);
    int serialNumberCheck(QString key);
    void paintEvent(QPaintEvent *event);
};

#endif // SECRETKEYACTIVATIONWIDGET_H
